<?php


namespace App\Model;


/**
 * App\Model\Store
 *
 * @property int $id
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property string $name 门店名称
 * @property string $province 省
 * @property string $city 市
 * @property string $area 区（县）
 * @property string $detail 详细地址
 * @property string $phone 电话
 * @property string $code 地址编码，逗号分隔
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store whereArea($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store whereCity($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store whereCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store whereDetail($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store wherePhone($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store whereProvince($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Store whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class Store extends Base
{

    protected $table='store';

    protected $fillable=['name','province','city','area','detail','phone','code'];




    function setCodeAttribute($value)
    {
//        dd($this->dat);

        if(!$value) return;

        if(!is_array($value)) return;

        $this->attributes['code']=join(',',$value);



    }



    function getCodeAttribute($value)
    {
        if(!$value) return [];

        return explode(',',$value);

    }


}
